
const express = require('express');

const router = express.Router();

router.all('/loong', (req,resp,next)=>{
    console.log( req.method , req.url , req.protocol + '/' + req.httpVersion );
    console.log( req.headers );
    console.log( req.body );
    next();
});

router.get('/loong', (req,resp)=>{
    resp.json( { id: 1234 , name: '敖广' } );
});

router.post('/loong', (req,resp)=>{
    resp.json( { code: 1 , message: 'post success' } );
});

router.put('/loong', (req,resp)=>{
    resp.json( { code: 2 , message: 'put success' } );
});

router.delete('/loong', (req,resp)=>{
    resp.json( { code: 3 , message: 'delete success' } );
});

router.head('/loong', (req,resp)=>{
    resp.json( { code: 4 , message: 'hello loong' } );
});

module.exports = router ;